package lianxi;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(urlPatterns="/jack")
public class JackServerlrt extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doGet(req, resp);
        //请求路径
        String urli = req.getRequestURI();
        StringBuffer url = req.getRequestURL();
        PrintWriter writer = resp.getWriter();
        //请求参数
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        System.out.println("username = " + username);
        System.out.println("password = " + password);

        writer.write("hello jack");
        writer.flush();
        writer.close();
    }

//    <servlet>
//        <servlet-name>JackServerlrt</servlet-name>
//        <servlet-class>lianxi.JackServerlrt</servlet-class>
//
//    </servlet>
//    <servlet-mapping>
//        <servlet-name>JackServerlrt</servlet-name>
//        <!---配置网址 http://localhost:8080   -->
//        <url-pattern>/timo</url-pattern>
//    </servlet-mapping>

}
